<?php

$html = "";
$url = isset($_GET['url']) ? $_GET['url'] : "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$show_notice = $template['show_notice'] < 2 ? 'alizi-full-row' : '';
$user_id = isset($cookie['uid']) ? $cookie['uid'] : $_SESSION['user']['id'];
$userInfo = M('User')->where(array('id' => $user_id))->field('pid,role')->find();
$user_pid = $userInfo['role'] == 'member' ? $userInfo['pid'] : $user_id;
$referer = isset($_GET['buildHtml']) ? '' : $_SERVER['HTTP_REFERER'];
$item_index = 0;
$package = !empty($info['params_name']) ? $info['params_name'] : lang('itemPackage');

if ($template['theme']) {
    //$html .= "<link href='".C('ALIZI_ROOT')."Public/Alizi/theme/{$template['theme']}/alizi.css?v=".ALIZI_VERSION."' rel='stylesheet'>";
}
if ($template['template']) {
    //$html .= "<link href='".C('ALIZI_ROOT')."Home/Tpl/Alizi/{$template['template']}/assets/alizi.css?v=".ALIZI_VERSION."' rel='stylesheet'>";
}

$color = json_decode($template['color'], true);

$html .= "<style>.alizi-border,.alizi-side.alizi-full-row{border-color:#{$aliziConfig['theme_color']};}";
if (isset($template['width'])) {
    $html .= ".alizi-detail-wrap{ max-width:{$template['width']};}";
}
if ($color) {
    $html .= "body,.alizi-order-wrap{background-color:#{$color['body_bg']};}.alizi-detail-content h2{border-top-color:#{$color['body_bg']};}.alizi-border,.alizi-side.alizi-full-row{border-color:#{$color['border']};}.alizi-detail-header dt{color:#{$color['font']};}.alizi-order{color:#{$color['font']};background-color:#{$color['form_bg']};}.alizi-title{background-color:#{$color['title_bg']};}.alizi-btn,.alizi-btn:hover, .alizi-btn:active,.alizi-badge,.alizi-params.active,.alizi-group-box input:checked + label:after{background-color:#{$color['button_bg']};border-color:#{$color['button_bg']};}.alizi-foot-nav{background-color:#{$color['nav_bg']};}.alizi-group.alizi-params.alizi-checkbox.active:hover{background-color:#{$color['button_bg']} !important;border-color:#{$color['button_bg']} !important;color:#fff !important;}";
}
$html .= "</style>";

$html .= '<div style="background-color: rgb(255, 255, 255); margin-top: 20px; width: 100%; height: 45px; display: flex; justify-content: left; align-items: center; font-size: 16px; color: rgb(85, 85, 85); border: 0px;"><span style="display: inline-block;width: 4px;height: 18px;margin: 16px 10px;background-color:#c50a1d;"></span>订单信息</div>';

$html .= "<div class='alizi-order alizi-lang-" . C('DEFAULT_LANG') . " alizi-border clearfix' id='aliziOrder'><div class='alizi-main alizi-border {$show_notice}'><div class='alizi-title alizi-title-order alizi-border ellipsis'><i class='icon-cart'></i>{$info['name']}</div>";

$html .= "<div class='alizi-content alizi-border'><form action='" . C('ALIZI_ROOT') . "index.php?m=Order&a=aliziBooking' method='post' id='aliziForm'><input type='hidden' name='lang' value='" . C('DEFAULT_LANG') . "'><input type='hidden' name='user_id' value='{$user_id}'><input type='hidden' name='user_pid' value='{$user_pid}'><input type='hidden' name='sn' value='{$info['sn']}'><input type='hidden' name='item_id' value='{$info['id']}'><input type='hidden' name='item_name' value='{$info['name']}'><input type='hidden' name='item_price' id='item_price' value='" . ($product ? $product[0]['price'] : $info['price']) . "'><input type='hidden' name='url' value='{$url}'><input type='hidden' name='redirect' value='" . ($template['redirect_uri'] ? $template['redirect_uri'] : $url) . "'><input type='hidden' name='referer' value='{$referer}'><input type='hidden' name='order_page' value='{$request['page']}'><input type='hidden' name='channel_id' value='{$cookie['ac']}'><input type='hidden' name='qrcode_pay' value='{$info['qrcode_pay']}'><input type='hidden' name='math' value='{$paymentDefault['math']}'><input type='hidden' name='page' value='{$page}'><input type='hidden' name='alizi_token' value='{$token}'><input type='hidden' name='buy_num' value='{$info['buy_num']}'><input type='hidden' name='buy_num_decrease' value='{$info['buy_num_decrease']}'>";


$html .= "<div class='alizi-box' id='alizi-box-1'>";
if (!empty($template['info']) && $request['page'] == 'single') {
    $html .= "<div class='alizi-brief clearfix'>{$template['info']}</div>";
}

$html .= "<input style='display: none' id='setJson' value='{$product_set_arrs}'>";

$product_set_php = json_decode($product_set_arrs, true);
if (!empty($product_set_php)) {
    // print_r($product_set_arrs);
    $html .= "<div class='alizi-rows clearfix rows-id-set rows-id-set-radio alizi-radio alize-set'><label class='rows-head'>套餐<span class='alizi-request'>*</span></label><div class='rows-params'>";
    $ti = 0;
    foreach ($product_set_php as $k => $vo) {
        $ti++;
        $html .= "<label class='alizi-set-set alizi-params alizi-radio " . ($ti == 1 ? "active" : "") . "'<span class='alizi-group-box'><input alizi-value='{$vo['title']}' class='radio-0' type='radio' value='{$vo['title']}' id='tc' name='tc' " . ($ti == 1 ? 'checked' : '') . "><label for='tc' class='selected-icon'></label></span>{$vo['title']}</label>";
    }
    $html .= "</div></div>";
}

//if (!empty($product_set_arrs)) {
//    // print_r($product_set_arrs);
//    $html .= "<div class='alizi-rows clearfix rows-id-params rows-id-params-radio alizi-radio'><label class='rows-head'>套餐<span class='alizi-request'>*</span></label><div class='rows-params'>";
//    $ti = 0;
//    foreach ($product_set_arrs as $k => $vo) {
//        $ti++;
//        $html .= "<label id='testJson" . $ti . "' class='alizi-group alizi-params alizi-radio " . ($ti == 1 ? "active" : "") . "'data-json='";
//        $html .= "[";
//        foreach ($vo['product_id'] as $k => $v) {
//            $html .= "name: 图片, imgList: {";
//            $product_params = json_decode($v['params'], true);
//            foreach ($product_params as $km => $vm) {
////                $html .= "<img  src='Public/Uploads/{$vm['image']}' />";
////                $html .= "<h2>{$vm['params_name']}</h2>";
//                $html .= "{imgUrl: Public/Uploads/" . "{$vm['image']}, imgName: " . "{$vm['params_name']}" . "},";
//            }
//            $html .= "},";
//        }
//        $html .= "]";
//        $html .= "'><span class='alizi-group-box'><input alizi-value='{$vo['title']}' class='radio-0' type='radio' value='{$vo['title']}' id='tc' name='tc' " . ($ti == 1 ? 'checked' : '') . "><label for='tc' class='selected-icon'></label></span>{$vo['title']}</label>";
//    }
//    $html .= "</div></div>";
//    $html .= "<script>console.log(JSON.parse(document.getElementById('testJson1').innerText))</script>";
//}
//$html .= "<p>---------------------分割线------------------</p>";
//
//if (!empty($product_set_arrs)) {
//    // print_r($product_set_arrs);
//    foreach ($product_set_arrs as $k => $vo) {
//        $html .= "<h1>{$vo['title']}</h1>";
//        // print_r($vo['title']);
////        foreach ($vo['product_name'] as $k => $v) {
////            // print_r($v);
////            // print_r('</br>');
////            $html .= "<div>";
////            $html .= "<div>";
////            $html .= "</div>";
////        }
//
//        foreach($vo['product_id'] as $k=>$v){
//
//            $product_params=json_decode($v['params'],true);
//            // print_r($product_params);
//            // print_r('sss</br>');
//            foreach($product_params as $km=>$vm){
//                $html .= "<img  src='Public/Uploads/{$vm['image']}' />";
//                $html .= "<h2>{$vm['params_name']}</h2>";
//            }
//
//
//            $product_ids=json_decode($v['extends'],true);
//            // print_r($product_ids);
//            // print_r('qqqq</br>');
//            foreach($product_ids as $k1=>$v1){
//                $attibute=explode('#',$v1['value']);
//                $html .= "<h2>{$v1['title']}</h2>";
//                $html .= "<ul>";
//                foreach($attibute as $k2=>$v2){
//                    // print_r($v);
//                    $html .= "<li>";
//                    $html .= "{$v2}";
//                    $html .= "</li>";
//                }
//                $html .= "</ul>";
//            }
//        }
//    }
//}
//
//$html .= "<p>---------------------分割线------------------</p>";

if (!empty($product)) {
    $html .= "<div class='alizi-rows clearfix rows-id-params rows-id-params-{$info['params_type']} alizi-{$info['params_type']}'><label class='rows-head'>" . $package . lang('request') . "</label><div class='rows-params'>";
    switch ($info['params_type']) {
        case 'select':
            $html .= "<select class='alizi-params-change' name='item_params[]' alizi-fx='alizi.quantity' alizi-fx-params='0'>";
            foreach ($product as $vo) {
                $html .= "<option value='{$vo['title']}' value-price='{$vo['price']}'>{$vo['title']}</option>";
            }
            $html .= "</select>";
            break;
        default:
            $i = 0;
            foreach ($product as $vo) {
                $i++;
                $html .= "<label alizi-value='{$vo['price']}' alizi-target='#item_price' alizi-fx='alizi.quantity' alizi-fx-params='0' class='" . ($vo['image'] ? ' alizi-params-image' : ' ellipsis') . " alizi-params  alizi-{$info['params_type']}" . ($i == 1 ? ' active ' : '') . "' title='{$vo['title']}'>";
//									下面是默认没有选中的，上面是默认选中第一项的
//									$html .= "<label alizi-value='{$vo['price']}' alizi-target='#item_price' alizi-fx='alizi.quantity' alizi-fx-params='0' class='package-select ".($vo['image']?' alizi-params-image':' ellipsis')." alizi-params  alizi-{$info['params_type']}' title='{$vo['title']}'>";


                if ($vo['image']) {
                    $html .= "<p class='item-image'><img src='" . imageUrl($vo['image']) . "' /></p>";
                }
                $html .= "<p class='item-desc'><input type='{$info['params_type']}' name='item_params[]' value='{$vo['title']}' " . ($i == 1 ? 'checked' : '') . ">{$vo['title']}</p></label>";
            }
            break;
    }
    $html .= "</div></div>";
}

//if (!empty($product_set_arrs)) {
//    // print_r($product_set_arrs);
//    foreach ($product_set_arrs as $k => $vo) {
//        $html .= "<h2>{$vo['title']}</h2>";
//        // print_r($vo);
//        foreach ($vo['product_name'] as $k => $v) {
//            // print_r($v);
//            // print_r('</br>');
//            $html .= "<div>";
//            $html .= "<div>";
//            $html .= "</div>";
//        }
//
//        foreach ($vo['product_id'] as $k => $v) {
//            $product_ids = json_decode($v['extends'], true);
//
//            // print_r($product_ids);
//            // print_r('qqqq</br>');
//            foreach ($product_ids as $k1 => $v1) {
//                $attibute = explode('#', $v1['value']);
//                $html .= "<h2>{$v1['title']}</h2>";
//                $html .= "<ul>";
//                foreach ($attibute as $k2 => $v2) {
//                    // print_r($v);
//                    $html .= "<li>";
//                    $html .= "{$v2}";
//                    $html .= "</li>";
//                }
//                $html .= "</ul>";
//            }
//            $product_params = json_decode($v['params'], true);
//
//            // print_r($product_params);
//            // print_r('sss</br>');
//            foreach ($product_params as $km => $vm) {
//                $html .= "<img  src='Public/Uploads/{$vm['image']}' />";
//                $html .= "<h2>{$vm['params_name']}</h2>";
//            }
//        }
//
//
//    }
//}

if (!empty($extends)) {
    foreach ($extends as $k => $vo) {
        //if($vo['type']=='text'){continue;}
        $disabled = '';
        if (strstr($vo['title'], '#')) {
            list($index, $vo['title']) = explode('#', $vo['title'], 2);
            $item_index = 1;
            $level = "1";
            if ($index == 1) {
                $disabled = '';
                $class = "extends extends-{$index}";
            } else {
                $disabled = 'disabled';
                $class = "extends extends-hidden extends-{$index}";
            }
        }

        if (strstr($vo['title'], '#')) {
            list($index2, $vo['title']) = explode('#', $vo['title'], 2);

            if ($index2 == 1) {
                $disabled = '';
                $class2 = "subextends subextends-{$index2}";
            } else {
                $disabled = 'disabled';
                $class2 = "subextends subextends-hidden subextends-{$index2}";
            }
            $level = "2";
        }


        $html .= "<div data-level='{$level}' class='have-attr alizi-rows clearfix rows-id-extends {$class} {$class2} extends-level-{$level} alizi-{$vo['type']}'><label class='rows-head'>{$vo['title']}" . lang('request') . "</label><div class='rows-params'>";
        switch ($vo['type']) {
            case 'text':
                $html .= "<input type='text' name='extends[{$extends_index}][]' placeholder='{$vo['value']}' autocomplete='off' class='alizi-input-text' {$disabled} {$disabled2}>";
                break;
            case 'password':
                $html .= "<input type='password' name='extends[{$extends_index}][]' placeholder='{$vo['value']}' autocomplete='off' class='alizi-input-text' {$disabled} {$disabled2}>";
                break;
            case 'select':
                $html .= "<select name='extends[{$extends_index}][]' {$disabled} {$disabled2}>";
                foreach (explode('#', $vo['value']) as $li) {
                    if (empty($li)) {
                        $html .= "<option value=''>" . lang('pleaseSelect') . "</option>";
                    } else {
                        $html .= "<option value='{$li}'>{$li}</option>";
                    }
                }
                $html .= "</select>";
                break;
            default:
                $i = 0;
                foreach (explode('#', $vo['value']) as $li) {
                    $i++;
                    $hidden = empty($li) ? 'style="display:none;"' : '';
                    $html .= "<label class='alizi-group alizi-params alizi-{$vo['type']} " . ($i == 1 ? 'active' : '') . "' {$hidden}><span class='alizi-group-box'><input alizi-value='{$li}' class='{$vo['type']}-{$k}' id='{$vo['title']}{$key}' name='extends[{$vo['title']}]" . ($vo['type'] == 'checkbox' ? '[]' : '') . "' type='{$vo['type']}' value='{$li}' " . ($i == 1 ? 'checked' : '') . " {$disabled}><label class='selected-icon' for='{$vo['title']}{$key}'></label></span>{$li}</label>";

//                                    下面是默认没有选中的，上面是默认选中第一项的
//									$html .= "<label class='attr-select alizi-group alizi-params alizi-{$vo['type']} ' {$hidden}><span class='alizi-group-box'><input alizi-value='{$li}' class='{$vo['type']}-{$k}' id='{$vo['title']}{$key}' name='extends[{$vo['title']}]".($vo['type']=='checkbox'?'[]':'')."' type='{$vo['type']}' value='{$li}' ".($i==1?'checked':'')." {$disabled}><label class='selected-icon' for='{$vo['title']}{$key}'></label></span>{$li}</label>";
                }
                break;
        }
        $html .= "</div></div>";
    }
}

$gift_index = 0;
$extends_index = 0;
$html .= "<div id='tcBox'>";
//$html .= "<div>{$product_set_arrs}</div>";
if (!empty($product_set_php)) {
    if(!empty($product_set_php[0]['title'])){
        $html .= "<div class='tc-title'>{$product_set_php[0]['title']}</div>";
    }
    foreach ($product_set_php[0]['products'] as $k => $v) {
        if(!empty($v['product_name'])){
            $html .= "<div class='tc-name'>{$v['product_name']}</div>";
        }
        $html .= "<input type='hidden' name='gift[{$extends_index}][id]' value='{$v['product_id']}'>";
        $html .= "<input type='hidden' name='gift[{$extends_index}][name]' value='{$v['product_name']}'>";
        if (!empty($v['product']['params_name'])) {
            $html .= "<div class='alizi-rows clearfix rows-id-extends extends-level-{$level} alizi-{$v['type']}'><label class='rows-head'>{$v['product']['params_name']}" . lang('request') . "</label><div class='rows-params'>";
            $i = 0;
            foreach (json_decode($v['product']['params'], true) as $k => $li) {
                $i++;
                $html .= "<label class='" . ($li['image'] ? ' alizi-params-image' : ' ellipsis') . " alizi-params alizi-{$info['params_type']}" . ($i == 1 ? ' active ' : '') . "' title='{$li['title']}'>";
                if ($li['image']) {
                    $html .= "<p class='item-image'><img src='" . imageUrl($li['image']) . "' /></p>";
                }
                $html .= "<p class='item-desc'><input type='{$info['params_type']}' name='gift[{$extends_index}][{$v['product']['params_name']}]' value='{$li['title']}' " . ($i == 1 ? 'checked' : '') . ">{$li['title']}</p></label>";
            }
            $html .= "</div></div>";
            $gift_index++;
        }
        if (!empty($v['product']['extends'])) {
            foreach (json_decode($v['product']['extends'], true) as $k => $ex) {
                $html .= "<div data-level='{$level}' class='alizi-rows clearfix rows-id-extends {$class} {$class2} extends-level-{$level} alizi-{$ex['type']}'><label class='rows-head'>{$ex['title']}" . lang('request') . "</label><div class='rows-params'>";
                $j = 0;
                foreach (explode('#', $ex['value']) as $val) {
                    $j++;
                    $hidden = empty($val) ? 'style="display:none;"' : '';
                    $html .= "<label class='alizi-group alizi-params alizi-{$ex['type']} " . ($j == 1 ? 'active' : '') . "' {$hidden}><span class='alizi-group-box'><input alizi-value='{$val}' class='{$ex['type']}-{$k}' id='{$ex['title']}{$val}' name='gift[{$extends_index}][{$ex['title']}]' type='{$ex['type']}' value='{$val}' " . ($j == 1 ? 'checked' : '') . " {$disabled}><label class='selected-icon' for='{$ex['title']}{$val}'></label></span>{$val}</label>";
                }
                $html .= "</div></div>";
                $gift_index++;
            }
        }
        $extends_index++;
    }
}
$html .= "</div>";


if ($params['quantity']['checked'] == false) {
    $html .= "</div><!--.alizi-box--><div class='alizi-box' id='alizi-box-2'>";
}
foreach ($params as $key => $vo) {
    if (empty($vo['checked'])) {
        continue;
    }
    $html .= "<div class='alizi-rows clearfix rows-id-{$key}'><label class='rows-head'>{$vo['name']}<span class='alizi-request " . ($vo['request'] ? '' : 'alizi-request-none') . "'>*</span></label><div class='rows-params'>";
    switch ($key) {
        case 'price':
            $html .= "<span class='alizi-shipping' " . ($info['shipping_id'] ? '' : "style='display:none;'") . "><strong class='alizi-order-price'>0.00</strong>+<strong class='alizi-shipping-price'>0.00</strong>(" . lang('shippingPrice') . ")=</span>" . lang('symbol') . "<strong class='alizi-total-price'>" . ($product ? $product[0]['price'] : $info['price']) . "</strong>" . $vo['info'];

            $html .= "</div></div>";
            $html .= "</div><!--.alizi-box--><div class='alizi-box' id='alizi-box-2'><div><div>";
            break;
        case 'payment':
            $html .= "<div class='alizi-payment clearfix'>";
            $i = 0;
            $firstPayment = 1;
            foreach ($payment as $key => $vo) {
                if ($key == 5 && empty($info['qrcode_pay'])) {
                    continue;
                }
                $i++;
                if ($i == 1) $firstPayment = $key;
                $html .= "<label alizi-value='{$key}' alizi-target=':payment' alizi-fx='alizi.payment' alizi-fx-params='{$key}' class='ellipsis alizi-params alizi-payment-{$key} " . ($i == 1 ? 'active' : '') . "'><input type='radio' name='payment' value='{$key}' " . ($i == 1 ? 'checked' : '') . ">{$vo['name']}</label>";
            }
            $html .= "</div><div id='alizi-payment-info' class='alizi-alert clearfix' " . ($payment[$firstPayment]['info'] ? '' : "style='display:none;'") . "><div class='payment-info'>{$payment[$firstPayment]['info']}</div></div>";
            break;
        case 'mobile':
            $html .= "<input type='tel' name='{$key}' placeholder='{$vo['info']}' autocomplete='off' class='alizi-input-text' alizi-request='{$vo['request']}' value='{$cookie[$key]}'>";
            break;
        case 'salenum':
            $html .= "<span>{$info['salenum']}</span>";
            break;
        case 'quantity':
            $html .= "<div class='alizi-quantity-group'><a class='quantity-dec' href='javascript:;' onclick='alizi.quantity(-1)'>-</a><input type='tel' class='alizi-quantity' size='4' value='1' name='quantity' onkeyup='alizi.quantity(0)'><a class='quantity-inc' href='javascript:;' onclick='alizi.quantity(1)'>+</a></div>";
            if (intval($info['buy_num']) > 0 && floatval($info['buy_num_decrease']) > 0) {
                $html .= "<div style='line-height:18px;padding:5px;font-size:12px;color:#999;clear: both'>" . sprintf(lang('decreaseInfo'), $info['buy_num'], $info['buy_num_decrease']) . "</div>";
            }
            break;
        case 'datetime':
            $date = date('Y-m-d', strtotime("+0 day"));
            $html .= "<input type='text' name='{$key}' placeholder='{$vo['info']}' autocomplete='off' class='alizi-input-text Wdate' alizi-request='{$vo['request']}' style='width:50%;' onfocus=\"WdatePicker({minDate:'$date'})\" value='{$cookie[$key]}'>
								<script type='text/javascript' src='__PUBLIC__/Assets/js/My97DatePicker/WdatePicker.js'></script>";
            break;
        case 'region':
            if (C('DEFAULT_LANG') == 'jp') {
                $regions = explode(',', L('regions'));
                $region = '';
                foreach ($regions as $reg) {
                    $region .= "<option value='{$reg}'>{$reg}</option>";
                }
                $html .= "<select name='region[province]' id='province' class='alizi-region alizi-region-province' style='width:100% !important;'>{$region}</select>";
            } else {
                $html .= "<select style='name='region[province]' id='province' class='alizi-region alizi-region-province' alizi-request='{$vo['request']}'></select>
									<select name='region[city]' id='city' class='alizi-region alizi-region-city' alizi-request='{$vo['request']}'></select>
									<select name='region[area]' id='area' class='alizi-region alizi-region-area' alizi-request='{$vo['request']}'></select>";

                if ('zh-cn' == C('DEFAULT_LANG')) {
                    $html .= "<script type='text/javascript'>seajs.use(['alizi/region'],function($,region){});</script>";
                } else {
                    $html .= "<script type='text/javascript'>var lang='" . C('DEFAULT_LANG') . "';seajs.use(['alizi/region-'+lang],function(region){ new PCAS('region[province]','region[city]','region[area]','{$cookie['region'][0]}','{$cookie['region'][1]}','{$cookie['region'][2]}');});</script>";
                }
            }
            break;
        case 'remark':
            $html .= "<textarea name='{$key}' placeholder='{$vo['info']}' class='alizi-input-text' alizi-request='{$vo['request']}' rows='2'></textarea>";
            break;
        case 'verify':
            $verify = 'http://' . $_SERVER['HTTP_HOST'] . C('ALIZI_ROOT') . 'index.php?m=Alizi&a=verify';
            if (!empty($request['verify'])) $verify .= '&' . http_build_query($request['verify']);
            $html .= "<input type='tel' name='{$key}' placeholder='{$vo['info']}' class='alizi-input-text' autocomplete='off' alizi-request='{$vo['request']}' style='width:30%;'>
								<img class='verify' src='{$verify}' onclick=\"$(this).attr('src','{$verify}&t='+new Date().getTime())\" />
								<a href='javascript:;' class='bright' onclick=\"$('.verify').attr('src','{$verify}&t='+new Date().getTime())\" />" . lang('changeVerifyCode') . "</a>";
            break;
        case 'code':
            $html .= "<input type='tel' name='{$key}' placeholder='{$vo['info']}' class='alizi-input-text' autocomplete='off' alizi-request='{$vo['request']}' style='width:50%;float:left;'>
								<button type='button' id='alizi-code' class='alizi-btn-min alizi-btn alizi-btn-ok' onclick=\"alizi.getCode()\" style='width:48%;font-weight:normal;float:right;padding:0.6rem 0;font-size:14px;' />" . lang('getMobileCode') . "<i></i></button>";
            break;
        default:
            $html .= "<input type='text' name='{$key}' placeholder='{$vo['info']}' autocomplete='off' alizi-request='{$vo['request']}' class='alizi-input-text' value='{$cookie[$key]}'>";
            break;
    }
    $html .= "</div></div>";
}

$html .= "</div><!--.alizi-box-->";
$html .= "<input type='hidden' name='item_index' value='{$item_index}'>";
$html .= "<div class='alizi-rows alizi-id-btn-send clearfix'><div class='toTop' onclick='toTop()'>top</div><script>function toTop(){scroll(0, 0);}</script><a href='/index.php?m=Order&a=query' class='queryOrder'>查詢訂單</a><input type='submit' id='alizi-submit' class='alizi-btn alizi-submit' value='" . lang('loadingSubmit') . "' disabled /></div></form></div></div>";

if ($template['show_notice']) {
    $html .= "<div class='alizi-side alizi-border {$show_notice}'><div class='alizi-title alizi-title-scroll alizi-border ellipsis'><i class='icon-shipping'></i>" . lang('orderNotification') . "</div><div class='alizi-delivery'><div class='alizi-scroll {$show_notice}'><ul>";
    if ($aliziConfig['real_notice'] == 1) {
        $orders = M('Order')->field('item_name,item_params,name,mobile,region,add_time')->where(array('item_id' => $info['id']))->order('id asc')->limit(25)->select();
        $i = 0;
        foreach ($orders as $li) {
            $region = explode(' ', $li['region']);
            $item_params = empty($li['item_params']) ? '' : ' - ' . $li['item_params'];
            $i++;
            $html .= "<li " . ($i % 2 == 0 ? "class='even'" : '') . "><p><span class='alizi-badge'>{$region[1]}</span>" . mb_substr($li['name'], 0, 1, 'utf-8') . "*[" . substr($li['mobile'], 0, 3) . "****" . substr($li['mobile'], -4) . "]</p><p><span class='alizi-date'>" . date('m-d', $li['add_time']) . "</span>{$li['item_name']}{$item_params}</p></li>";
        }
    } else {
        $item = json_decode($info['params'], true);
        $province = explode(',', L('scrollProvince'));
        $name = explode(',', L('scrollName'));
        $mobile = explode(',', L('scrollMobile'));
        $time = explode(',', L('scrollTime'));
        for ($i = 0; $i < 50; $i++) {
            $num = rand(0, 3);
            $pro = empty($item) ? '' : ' - ' . $item[array_rand($item, 1)]['title'];
            $pp = $province[array_rand($province, 1)];
            $nn = $name[array_rand($name, 1)];
            $mm = $mobile[array_rand($mobile, 1)] . '****' . randCode(4);
            $rand = array_rand($time);
            $html .= "<li " . ($i % 2 == 0 ? "class='even'" : '') . "><p><span class='alizi-badge'>{$pp}</span>{$nn}*[{$mm}]</p><p><span class='alizi-date'>{$time[$rand]}</span>{$info['name']}{$pro}</p></li>";
        }
    }
    $html .= "</ul></div></div></div><script type='text/javascript'>seajs.use(['jquery','alizi','alizi/scroll'], function(jQuery,alizi,scroll) {alizi.resize('{$template['show_notice']}');jQuery(window).resize(function(){ alizi.resize('{$template['show_notice']}');});var scrollHeight = jQuery('.alizi-scroll li').innerHeight();jQuery('.alizi-scroll').aliziScroll({speed:40,rowHeight:scrollHeight});});</script>";
}
$html .= "</div></div>";

$html .= "<script type='text/javascript'>seajs.config({vars: {'payment':" . json_encode($payment) . ",'shipping':" . json_encode($shipping) . "}});</script>";
return $html;
?>
